package com.fxy.demowebsockettest.service.impl;

import com.fxy.demowebsockettest.mapper.TbUserMapper;
import com.fxy.demowebsockettest.pojo.TbUser;
import com.fxy.demowebsockettest.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private TbUserMapper userMapper;

    @Override
    public List<TbUser> list() {
        return userMapper.selectList(null);
    }

    @Override
    public void delete(Integer id) {
        userMapper.deleteById(id);
    }

    @Override
    public TbUser getById(Integer id) {
        return userMapper.selectById(id);
    }

    @Override
    public void update(TbUser user) {
        userMapper.updateById(user);
    }

    @Override
    public void add(TbUser user) {
        userMapper.insert(user);
    }
}
